import xml.etree.ElementTree as ET
import matplotlib.pyplot as plt

root = ET.parse("D:\\StarCraft\\bwapi-data\\logs\\g.xml").getroot()
generation = root.findall("generation")
generation = generation[0]

id = 0
top = 0
i = 0

for g in generation:
	f = 0
	for o in g.findall("objective"):
		f += float(o.get("fitness"))
	f = f/4
	if f > top:
		top = f
		id = i
	i += 1
	
print id
print generation[id].find("objective").get("fitness")